/*
 * Copyright (C) 2014 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME attribute: FTTR MQTT Agent (65509)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME attribute: FTTR MQTT Agent (65509)
 */

#ifndef __MIB_FTTRMQTTAGENT_TABLE_H__
#define __MIB_FTTRMQTTAGENT_TABLE_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Table FTTR MQTT Agent attribute len, only string attrubutes have length definition */
#define MIB_TABLE_AVLUSPMTPTABLE_LEN (15)
#define MIB_TABLE_CONTROLLERTABLE_LEN (26)

/* Table FTTR MQTT Agent attribute index */
#define MIB_TABLE_FTTRMQTTAGENT_ATTR_NUM (3)
#define MIB_TABLE_FTTRMQTTAGENT_ENTITYID_INDEX ((MIB_ATTR_INDEX)1)
#define MIB_TABLE_FTTRMQTTAGENT_AVLUSPMTP_INDEX ((MIB_ATTR_INDEX)2)
#define MIB_TABLE_FTTRMQTTAGENT_CONTROLLERTBL_INDEX ((MIB_ATTR_INDEX)3)

#define USP_SERVER_NAME_ENTRY_CNT_PER_GET (5)

typedef struct avlUspMtpTableEntry_s
{
	UINT8								serviceName[MIB_TABLE_AVLUSPMTPTABLE_LEN];
	LIST_ENTRY(avlUspMtpTableEntry_s)	entries;
} __attribute__((packed)) avlUspMtpTableEntry_t;

typedef struct omci_controller_tbl_entry_s
{
	UINT16 	controller_network_addr;				/* default 8883*/
	UINT8   tableCtrl;
	UINT16  associatedTag;							/* default 0xFFFF*/
	UINT16  provisioning_code;						/* default 0xFFFF*/
	UINT16  usp_retry_min_wait_interval;			/* default 5sec*/
	UINT16  usp_retry_interval_multiplier;			/* default 2000*/
	UINT8   mtp_used[MIB_TABLE_AVLUSPMTPTABLE_LEN];	/* default usp_agt_mqtt */      
	#if 0
	UINT16  forward_addr;
	UINT16	retry_second;
	UINT16	backup_server;	
	#endif
} __attribute__((packed)) omci_controller_tbl_entry_t;

typedef struct controllerTableEntry_s
{
	omci_controller_tbl_entry_t			tableEntry;
	LIST_ENTRY(controllerTableEntry_s)	entries;
} __attribute__((packed)) controllerTableEntry_t;

/* Table FTTR MQTT Agent attribute len, only string attrubutes have length definition */
typedef struct 
{
	UINT16   EntityId;
	UINT8    AvlUspMtp[MIB_TABLE_AVLUSPMTPTABLE_LEN];
	UINT8    ControllerTbl[MIB_TABLE_CONTROLLERTABLE_LEN];
	UINT16	 curAvlUspMtpEntryCnt;
	UINT16	 curControllerEntryCnt;
	LIST_HEAD(avlUspMtpHead, avlUspMtpTableEntry_s) avlUspMtphead;
	LIST_HEAD(controllerHead, controllerTableEntry_s) controllerhead;
} __attribute__((packed)) MIB_TABLE_FTTRMQTTAGENT_T;


#ifdef __cplusplus
}
#endif

#endif
